# encoding: utf-8
# author: 侯佳涛
# file_name: views
# create_time: 2022/2/14, 下午7:16
from django.contrib.auth.mixins import LoginRequiredMixin
from django import http

from meiduo_mall.utils.response_code import RETCODE


class LoginRequiredJSONMixin(LoginRequiredMixin):
    """重写handle_no_permission方法，返回JSON数据"""
    def handle_no_permission(self):
        return http.JsonResponse({'code': RETCODE.SESSIONERR, 'errmsg': '用户未登录'})
